/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-10-10
 * Time: 15:25
 */
//获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
public class TestDemo {
    public static void main(String[] args) {
        int n = 10;
        System.out.println("奇数位为：");
        for (int i = 0; i < 30; i += 2) {
            System.out.print(((n >>> i) & 1) + " ");
        }
        System.out.println();
        System.out.println("偶数位为：");
        for (int i = 1; i < 31; i+=2) {
            System.out.print(((n >>> i) & 1) + " ");
        }
    }
}
